<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>查不清户籍人员-核查中-接收</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        table {
            border-collapse:separate;
            border-spacing:6px;
        }
    </style>
</head>
<body>
<form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
    <!-- 用户编辑框START-->
    <div id="hjHc" class="form" style="padding:10px;">
        <input name="id" id="id" class="mini-hidden" value="${prisonerHc.id}" style="width: 100%" />
        <input name="priNum" id="priNum" class="mini-hidden" value="${prisonerHc.prinum}" style="width: 100%" />
        <table class="form-table" align="center" style="table-layer:fixed">
            <tr>
                <td style="white-space:nowrap">户籍分类:</td>
                <td>
                    ${prisonerHc.hjlx!''}
                </td>
            </tr>
            <td style="white-space:nowrap">原侦查机关地址:</td>
            <td>
                ${prisonerHc.investigate!''}
            </td>
            <tr>
                <td style="white-space:nowrap">罪犯姓名:</td>
                <td>
                    ${prisonerHc.name!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</td>
                <td>
                    ${prisonerHc.sex!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">身份号码:</td>
                <td>
                    ${prisonerHc.idnum!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">服刑单位:</td>
                <td>
                    ${prisonerHc.prisonerName!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起接收人员姓名:</td>
                <td>
                    ${prisonerHc.startCheckPerson!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起接收人员固定电话:</td>
                <td>
                    ${prisonerHc.startCheckTel!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起接收人员移动电话:</td>
                <td>
                    ${prisonerHc.startCheckPhone!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap">发起接收时间:</td>
                <td>
                    ${prisonerHc.startCheckTime!''}
                </td>
            </tr>
            <tr>
                <td style="white-space:nowrap"><font color="#dc143c">*</font>备注信息:</td>
                <td>
                    <textarea id="priReason" name="priReason" style="width: 100%;" class="mini-textarea"
                              emptyText="请输入备注" value="${prisonerHc.priReason!''}"></textarea>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table class="form-table" align="center">
            <tr>
                <td><font color="#dc143c">*</font>接收人员:</td>
                <td class="input">
                    <input name="conmectuserName" id="conmectuserName" value="${startCheckPerson!''}"
                           style="width: 120px" class="mini-textbox" required="true" />
                </td>
                <td>接收人手机号码:</td>
                <td class="input">
                    <input name="conmectuserPhone" id="conmectuserPhone" value="${startCheckPhone!''}"
                           style="width: 110px" emptyText="请输入手机号码" class="mini-textbox" onvaluechanged="checkPhone(2)"/>
                </td>
                <td>接收人固话:</td>
                <td class="input">
                    <input name="conmectuserTelphone" id="conmectuserTelphone" value="${startCheckTelPhone!''}"
                           style="width: 110px" emptyText="请输入固定电话" class="mini-textbox" onvaluechanged="checkPhone(1)"/>
                </td>
            </tr>
            <tr></tr>
        </table>
    </div>
    <div style="padding:5px;margin: 0 auto;text-align: center">
        <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px"
           onclick="saveData('-1')">保存</a>
        <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px"
           onclick="saveSuccessData()">核查成功</a>
    </div>
</form>
<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");
    var conmectuserPhone = mini.get("conmectuserPhone");
    var conmectuserTelPhone = mini.get("conmectuserTelphone");
    var priReason = mini.get("priReason");

    function saveSuccessData() {
        saveData("3")
    }

    function SetData(data){

    }

    function saveData(state) {
        form.validate();
        var phone = conmectuserPhone.getValue();
        var tel = conmectuserTelPhone.getValue();
        var newPhone = checkTelAndPhone(tel,phone);
        var flag = newPhone['flag'];
        var kflag = newPhone['kflag'];
        if ('-1' === kflag) {
            mini.alert("请至少输入一个联系方式");
            return;
        }
        if (flag) {
        } else {
            mini.alert("手机号码或固话有误，请重填");
            return;
        }
        if (priReason.getValue() == "") {
            mini.alert("请输入备注信息");
            return;
        }
        if (form.isValid() == false) {
            return;
        }
        var data = form.getData();
        var json = mini.encode(data);
        commonSaveData("/azbj/verification/hcstate", {
            data: json,
            prinum: mini.get("priNum").getValue(),
            state: state
        }, callback);

        // 保存成功的回调函数
        function callback() {
            mini.alert("保存成功", "成功", window.CloseOwnerWindow);
        }
    }

    function checkPhone(e) {
        var phone = conmectuserPhone.getValue();
        var telPhone = conmectuserTelPhone.getValue();
        if (e == '1') {
            if(!validateTel(telPhone)) {
                mini.alert("固定电话有误，请重填");
            }
        }
        if (e == '2') {
            if(!validatePhone1(phone)) {
                mini.alert("手机号码有误，请重填");
            }
        }
    }
</script>
</body>
</html>